home *** CD-ROM | disk | FTP | other *** search
- #ifndef H_OOFctree
- #define H_OOFctree
-
- // OOFILE c-tree Plus backend implementation
- // EXPORTED header - this is the one included in client programs
-
- #include "oof1.hpp"
- #include "oof3.hpp" // non-numeric fields
- #include "oof4.hpp" // numeric fields
-
- #ifdef _Macintosh
- // Macintosh programmers only, hack to allow setting types
- extern long ctMacCreator;
- extern long ctMacType;
- #endif
-
-
- class dbConnect_ctree : public dbConnect {
- public:
- enum eLockingStates {noLocking, readLocking, writeLocking};
-
- dbConnect_ctree() :
- mHasBlobs(false),
- mUseSuperfile(true),
- mLockingState(noLocking),
- mReadLockApplications(0),
- mWriteLockApplications(0)
- {
- };
-
- virtual ~dbConnect_ctree();
- private:
- dbConnect_ctree(const dbConnect_ctree&) { assert(0); }; // NEVER CALLED
-
- public:
- virtual void newConnection(const char* connectionName);
- virtual void openConnection(const char* connectionName);
- virtual void close();
-
- // special settings specific to this concrete connection
- void useSeparateFiles();
-
- bool isReadLocked() const;
- bool isWriteLocked() const;
- void resetLocks() const;
-
- // interchange with OOF_ctreeTableBackend
- void blobsHaveBeenFound();
- long allocBlobFilNo();
-
- // locking
- virtual void exitLocking();
- virtual void enterWriteLocking();
- virtual void enterReadLocking();
-
- // utility
- OOF_String makeTableName(const char*) const;
-
- private:
- void SetLockingStyle(eLockingStates);
- virtual OOF_tableBackend *MakeTableBackend(dbTable*);
- virtual void SetupConnection(const OOF_String& connectionName);
- void OpenMySpecialTables(const OOF_String& connectionName);
- void CreateMySpecialTables(const OOF_String& connectionName);
-
-
-
- // data storage
- bool mHasBlobs, mUseSuperfile;
- eLockingStates mLockingState;
- int mReadLockApplications, mWriteLockApplications;
- long mSuperFilNo, mBlobFilNo;
-
- public:
- static long sFileMode;
- };
- ostream& operator<<(ostream& os, dbConnect_ctree& connect);
-
-
- // include inline definitions
- #include "oofctree.inl"
-
- #endif